<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .container{
            width:800px;
            border:1px solid red;
        }
        .d1{
            width:200px;
            height: 300px;
            background: blue;

            /*设置浮动，元素会脱离常规的文档流*/
            float:left;
        }
        .d2{
            width:300px;
            height:400px;
            background: green;
            float:left;
        }
        .d3{
            width:200px;
            height:100px;
            background: pink;
            float:right;
        }

        /*由于浮动脱离常规文档流，导致父元素无法计算出高度， 此时可以清除浮动*/
       /*1.给父元素一个固定高度*/
        /*2.在浮动元素的后面添加一个空的div块，给空的块级元素设置清除浮动clear:left|right|both*/
        .c{
            width:400px;
            height: 500px;
            background:yellow;
        }
        .clear{
            clear:both;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="d1"></div>
        <div class="d2"></div>
        <div class="d3"></div>
        <div class="clear"></div>
    </div>

</body>
</html>